import request from '@/utils/request'

// 获取当前组织的用户
/**
 *
 * @param {
	"appId": "",
	"appTypeId": 0,
	"applicationTypes": [
		{
			"guid": "",
			"type": 0
		}
	],
	"briefIntroducti": "",
	"details": "",
	"domainName": "",
	"homePage": "",
	"logo": "",
	"name": "",
	"security": ""
} params
 */
export function getList(params) {
  return request({
    url: '/application/add-application',
    method: 'post',
    params
  })
}
export function getAppType() {
  return request({
    url: '/application/application-types',
    method: 'post'
  })
}

/**
 *
 * {
	"guid": "",
	"name": ""
			} params
 */
export function getOrgAndUser(params) {
  return request.post(
    '/organization/get-user-organization-and-user',
    params
  )
}

/**
 *
 * {
	"appId": "",
	"appTypeId": 0,
	"applicationTypes": [
		{
			"guid": "",
			"type": 0
		}
	],
	"briefIntroducti": "",
	"details": "",
	"domainName": "",
	"homePage": "",
	"logo": "",
	"name": "",
	"organizationGuid": "",
	"security": ""
} params
 */
export function addApp(params) {
  return request.post(
    '/application/add-application',
    params
  )
}
// 更新应用
export function editApp(params) {
  return request.post(
    'application/update-application',
    params
  )
}
// 查询应用信息
export function getApp(params) {
  return request.post(
    '/application/application-details',
    params
  )
}
// 查询应用下的组织-分页
/**
 *
 * @param {
	"applicationId": 0,
	"pageNo": 0,
	"pageSize": 0
	} params
 * @returns
 */
export function getAppOrg(params) {
  return request.post(
    '/application/get-application-organization',
    params
  )
}
// 查询应用下的用户-分页
/**
 *
 * @param {
	"applicationId": 0,
	"pageNo": 0,
	"pageSize": 0
	} params
 * @returns
 */
export function getAppUser(params) {
  return request.post(
    '/application/get-application-user',
    params
  )
}
/**
 *
 * @param {id: 0} params
 * @returns
 */
export function deleteAppTypeById(params) {
  return request.post(
    '/application/delete-application-type',
    params
  )
}
/**
 *
 * @param {id: 0} params
 * @returns
 */
export function deleteAppById(params) {
  return request.post(
    '/application/delete-application',
    params
  )
}
/**
 *
 * @param {name: ''} params
 * @returns
 */
export function addAppTypeById(params) {
  return request.post(
    '/application/add-application-type',
    params
  )
}
/**
 *
 * @param {id: 0, name: ''} params
 * @returns
 */
export function updateAppTypeById(params) {
  return request.post(
    '/application/update-application-type',
    params
  )
}
/**
 *
 * @param {id: 0} params
 * @returns
 */
export function updateAppSecurity(params) {
  return request.post(
    '/application/update-application-security',
    params
  )
}
/**
 * 添加收藏
 * @param {id: 0} params
 * @returns
 */
export function addAppCollection(params) {
  return request.post(
    '/application/add-application-collection',
    params
  )
}

export function latelyAppUsed(params) {
  return request.post(
    '/application/select-application-lately',params
  )
}

export function latelyAppAdd(params) {
  return request.post(
    '/application/add-application-lately',params
  )
}

export function collectedApp(params) {
  return request.post(
    '/application/select-application-collection',params
  )
}

export function getPcNews() {
  return request.post(
    '/application/select-application-notice'
  )
}

export function getMobileNews() {
  return request.post(
    '/application/select-application-mobile-notice'
  )
}

// 修改组织状态
/**
 *
 * @param {
      "id": 0,
      state: 0|1|2
    } params
 */
export function updateOrgState(params) {
  return request.post('/user/update-organization-state',params)
}

